POV-Ray : Newsgroups : povray.general : Interlocking Heightfields. : Re: Interlocking Heightfields. Server Time
31 Jul 2024 04:27:09 EDT (-0400)
  Re: Interlocking Heightfields.  
From: Stephen
Date: 12 May 2008 09:18:30
Message: <vlgg24d2uho0olc8us6unf682kdm9nooh7@4ax.com>
On Mon, 12 May 2008 14:24:56 +0200, "Thomas de Groot"
<t.d### [at] internlDOTnet> wrote:

>Hmmm... Here is a solution. However, there is a problem I had not foreseen. 
>While the joining edges are perflectly parallel to each other, the adjoining 
>surfaces make a sharp angle in some places. I wonder how to solve that...
>
>Here is a little bit of code:

Thanks Thomas, on cleaning up my code (below) I found your problem.
But I also discovered that I don't understand the "function", function
:) 

#version 3.6;

background { color rgb <0.000,0.000,0.000> }    

   global_settings {noise_generator 3}


//*****************************************************************************
// referenced scene items and forced visible scene items declaration
begin
//*****************************************************************************

#declare Shadow_Clouds_Bot =
pigment {
  bozo
  color_map {
    [0.000 rgbft <0.850,0.850,0.850,0.000,0.000>]
    [0.100 rgbft <0.750,0.750,0.750,0.000,0.000>]
    [0.500 rgbft <1.000,1.000,1.000,0.000,1.000>]
  }

  rotate    <0.0,0.0,90.000>
  rotate    <180.000,0.0,0.0>
  scale     <1.000,6.000,6.000>
  rotate    <-180.000,0.000,-90.000>
  translate <0.000,-0.150,0.000>
  turbulence <0.650,0.650,0.650>
  octaves 6
  lambda 2.000
  omega 0.700
}

#declare Shadow_Clouds_Top =
pigment {
  color rgbft <0.196,0.600,0.800,0.000,0.000>
}

#declare Shadow_Clouds_Mid =
pigment {
  bozo
  color_map {
    [0.000 rgbft <0.850,0.850,0.850,0.000,0.000>]
    [0.100 rgbft <0.750,0.750,0.750,0.000,0.000>]
    [0.500 rgbft <1.000,1.000,1.000,0.000,1.000>]
  }

  rotate    <0.0,0.0,90.000>
  rotate    <180.000,0.0,0.0>
  scale     <1.000,6.000,6.000>
  rotate    <-180.000,0.000,-90.000>
  turbulence <0.650,0.650,0.650>
  octaves 6
  lambda 2.000
  omega 0.700
}

#declare SMcA_White0 =
texture {
  pigment {
    color rgbft <1.000,1.000,1.000,0.000,0.000>
  }

  finish {
    ambient     rgb <0.100,0.100,0.100>
    brilliance  1.000
    crand       0.000
    diffuse     0.600
    metallic    0.000
    phong       0.000
    phong_size  40.000
    specular    0.000
    roughness   0.050
  }

}

#declare SMcA_Green0 =
texture {
  pigment {
    color rgbft <0.2000,0.5000,0.2000,0.000,0.000>
  }

  finish {
    ambient     rgb <0.0100,01.100,0.0100>
    brilliance  0.5000
    crand       0.000
    diffuse     0.600
    metallic    0.000
    phong       0.000
    phong_size  40.000
    specular    0.000
    roughness   0.50
  }

}


////////////////////////////////////////////////////////////////////


#declare ColT=3;

#declare RowT=3;


#declare Col=1;

#while (Col<=ColT)

        #declare Row=1;

                #declare X_Scaler =select(mod(Col, 2), 1, 0, 1)  ;  //
Odd or even Col

        #while (Row<=RowT)

                #declare Z_Scaler =select(mod(Row, 2), 1, 0, 1)  ; //
Odd or even Row

           #declare HF =
   height_field { 
     
      function 100, 100  {pattern {spotted scale 0.25  rotate -90*x }}
smooth
       translate <-0.5,0,-0.5>
       scale <25,5,25>
   
        #if (X_Scaler = 0)   
        #debug concat( "Col X_Scaler: ",str(X_Scaler,5,0),"\n")

                #if (Z_Scaler = 0)  
                        #debug concat( "Row Z_Scaler:
",str(X_Scaler,5,0),"\n")
                        
                        scale <-1,1,-1> 
                                #else
                                scale <-1,1,1>
                        #end           
                
                #else  
                
                #debug concat( "Col X_Scaler:
",str(X_Scaler,5,0),"\n")
                
                #if (Z_Scaler = 0)    
                        #debug concat( "Row Z_Scaler:
",str(X_Scaler,5,0),"\n")
                        scale <1,1,-1> 
                                #else
                                scale <1,1,1>
                                #end     
                       
                        #end       
                        
      translate <-25*Col,0,-25*Row>



   }
        object { HF

         texture{ SMcA_Green0 }


        }

        #declare Row=Row+1;

        #end

        #declare Col=Col+1;

#debug concat( "X_Scaler is: ",str(X_Scaler,5,0),"\n")
#end



///////////////////////////////////////////////////////////////////////



#declare Camera0 =
camera {
  perspective
  location <-50.000,300.000,-70.000>
  up y
  right 1.333*x
  angle 50.000
  sky <0,1,00>
  look_at < 0,0,-70 >
}


//*****************************************************************************
// referenced scene items and forced visible scene items declaration
end
//*****************************************************************************

light_source {  // Light_Source1
  < 50, 0.000000, -50 >, color rgb <1.000,1.000,1.000>
  fade_power 0.000
  fade_distance 100.000
  media_attenuation off
  media_interaction on
  translate <21.797291,33.663000,-0.606643>
}
sky_sphere {  // SkySphere1
  pigment{ Shadow_Clouds_Top }
  pigment{ Shadow_Clouds_Mid }
  pigment{ Shadow_Clouds_Bot }

}



plane {  // Plane1
  y , -1
  texture{ SMcA_White0 }
}

camera{ Camera0 }
-- 

Regards
     Stephen


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.